import request from '@/config/axios'

export function useSupplierApi() {
    return {
        // 列表
        getList: async (params: any) => {
            return await request.get({url: '/yxt/supplier/list', params})
        },
        // 查询
        getObj: async (id: number) => {
            return await request.get({url: '/yxt/supplier/get?id=' + id})
        },
        // 新增
        createObj: (data: any) => {
            return request.post({url: '/yxt/supplier/create', data})
        },
        // 更新
        updateObj: (data: any) => {
            return request.post({url: '/yxt/supplier/update', data})
        },
        // 所有下拉选择
        getSimpleList: async () => {
            return await request.get({url: '/yxt/supplier/get-simple-list'})
        },
        // 设备列表
        getEquipmentList: async (params: any) => {
            return await request.get({url: '/yxt/supplier/get-equipment-list', params})
        },
    }
}

export function useEquipmentApi() {
    return {
        // 分页
        getPage: async (params: any) => {
            return await request.get({url: '/yxt/equipment/page', params})
        },
        // 查询
        getObj: async (id: number) => {
            return await request.get({url: '/yxt/equipment/get?id=' + id})
        },
        // 新增
        createObj: (data: any) => {
            return request.post({url: '/yxt/equipment/create', data})
        },
        // 更新
        updateObj: async (data: any) => {
            return await request.post({url: '/yxt/equipment/update', data})
        },
        // 删除
        deleteObj: async (id: number) => {
            return await request.delete({url: '/yxt/equipment/delete?id=' + id})
        },
        // 设备列表下拉选项
        getSimpleList: async (params: any) => {
            return await request.get({url: '/yxt/equipment/get-simple-list', params})
        },
    }
}
